Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to make snort3_demo more portable #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

wtfbbqhax
Copy link

@wtfbbqhax wtfbbqhax commented Jul 27, 2023

Snort3 demo is having trouble running on my baseline Snort environment Krakatoa

This PR introduces a few small cleanups that improve portability of the snort3_demo environment.

My intention is to use the snort3_demo as the testing framework for Snort3 in all of my environments (Open and Private repos).

Prior to my changes running run_tests.sh failed 85 of 85 test

After my changes, the tests pass 78 of 85 tests

Total = 85, Pass = 78, Fail = 7, Skip = 0

My primary commit message follows


snort3_demo: Refactor run_test.sh script

This commit refactors the snort3_demo repository so that it can be executed
somewhat more portably, and ideally feels a bit more comfortable to the user.

These changes make one big assumption, namely:

  • snort and libdaq are installed to the default PREFIX directory
    (/usr/local).

    With this assumption made, the user is no longer responsible for
    specifying the install location for "snorty", i.e., argv[1] will
    now specify the path of tests to execute.

    NOTICE: If necessary, I will provide an override in the form of an
    environment variable to restore specifying an alternate
    install PREFIX.

Now argv[1] specifices the path to the "top" directory to search for,
and run tests from. The following commands are now all valid:

  • ./run_tests.sh tests/ips_options

    Runs all tests under "tests/ips_options/*"

  • ./run_tests.sh tests/ips_options/so_and_soid

    Runs the singular test under "tests/ips_options/so_and_soid/"

  • ./run_tests.sh tests/ips_options/so_and_soid/test.bats

    Identical to the previous exmaple, runs the singular test under
    "tests/ips_options/so_and_soid/"

  • ./run_tests.sh /root/alternate-path/some-private/integration-tests/

    Runs all the tests under the user specified external directory.

The last major refactor to the script is the way which tests are
"searched and exected". Previously, the run_tests.sh used find to
create a singular long command line argument of "directories" containing
the "tests.bat" script, passing it as an argument to a loop defined in
the same file.

The script is now chagned to use find -exec run_one, which is
functionally equivalent, but is now future proofed from maxing out
command line arguments, or size of a command line in the given shell.

NOTICE: Acceptance of this PR will surely result in further refactorying
to make the environment more portable still.

@wtfbbqhax wtfbbqhax force-pushed the more-portable-snort3-demo branch 2 times, most recently from 41801e1 to 7535244 Compare July 27, 2023 02:34
This commit refactors the snort3_demo repository so that it can be executed
somewhat more portably, and ideally feels a bit more comfortable to the user.

These changes make one big assumption, namely:

 * snort and libdaq are installed to the default PREFIX directory
   (/usr/local).

   With this assumption made, the user is no longer responsible for
   specifying the install location for "snorty", i.e., `argv[1]` will
   now specify the path of tests to execute.

   NOTICE: If necessary, I will provide an override in the form of an
	   environment variable to restore specifying an alternate
	   install PREFIX.

Now argv[1] specifices the path to the "top" directory to search for,
and run tests from. The following commands are now all valid:

 * ./run_tests.sh tests/ips_options

    Runs all tests under "tests/ips_options/*"

 * ./run_tests.sh tests/ips_options/so_and_soid

    Runs the singular test under "tests/ips_options/so_and_soid/"

 * ./run_tests.sh tests/ips_options/so_and_soid/test.bats

    Identical to the previous exmaple, runs the singular test under
    "tests/ips_options/so_and_soid/"

 * ./run_tests.sh /root/alternate-path/some-private/integration-tests/

    Runs all the tests under the user specified external directory.

The last major refactor to the script is the way which tests are
"searched and exected". Previously, the run_tests.sh used `find` to
create a singular long command line argument of "directories" containing
the "tests.bat" script, passing it as an argument to a loop defined in
the same file.

The script is now chagned to use `find -exec run_one`, which is
functionally equivalent, but is now future proofed from maxing out
command line arguments, or size of a command line in the given shell.

NOTICE: Acceptance of this PR will surely result in further refactorying
        to make the environment more portable still.
@wtfbbqhax wtfbbqhax force-pushed the more-portable-snort3-demo branch from 7535244 to 3de4a52 Compare July 27, 2023 03:57
@wtfbbqhax wtfbbqhax force-pushed the more-portable-snort3-demo branch from 3de4a52 to 8884ea2 Compare July 27, 2023 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant